package cn.medemede.k2;

public class Cube extends Rectangle {

    double z;

    Cube(){
        name="长方体";
    }

    @Override
    public double area() {
        return (x*y+x*z+y*z)*2;
    }

    @Override
    public double perimeter() {
        return (x+y+z)*4;
    }

    @Override
    public String toString() {
        return "Cube{" +
                "z=" + z +
                ", x=" + x +
                ", y=" + y +
                ", name='" + name + '\'' +
                '}';
    }
}
